<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="bannerImg" alt="">
      <div class="banner-info">
        <div class="banner-title">{{title}}</div>
        <div class="banner-number"><span class="iconfont banner-icon">&#xe692;</span>{{gallaryList.length}}</div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs="gallaryList" v-show="showGallary" @close="handleGallaryClose"></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/fade/FadeAnimation'
export default {
  name: 'DetailBanner',
  components: {
    CommonGallary: CommonGallary,
    FadeAnimation: FadeAnimation
  },
  props: {
    bannerImg: String,
    title: String,
    gallaryList: Array
  },
  data () {
    return {
      showGallary: false
    }
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleGallaryClose () {
      this.showGallary = false
    }
  }
}
</script>

<style lang="stylus" scoped>
.banner
  overflow: hidden
  height:0
  padding-bottom: 55.2%
  position:relative
  .banner-img
    width:100%
  .banner-info
    display:flex
    position: absolute
    left: 0
    right: 0
    bottom: 0
    line-height: .6rem
    color:#fff
    background-image: linear-gradient(top,rgba(0,0,0,0), rgba(0,0,0,.8))
    .banner-title
      font-size:.28rem
      padding: .2rem
      flex:1
    .banner-number
      height:.4rem
      margin-top:.28rem
      padding:0 .4rem
      line-height:.4rem
      font-size:.28rem
      border-radius .2rem
      background:rgba(9,9,9,.6)
      .banner-icon
        font-size:.28rem
        margin-right:.1rem
</style>
